$(function(){

$("a.star").hover(
	function(){
		rid=this.id.substring(1);
		$("#rating").children("a").slice(0,rid).addClass('starhover');
	},
	function(){
		$("#rating").children("a").filter('.starhover').removeClass('starhover');
	})
	.click(function(){
		$.ajax({ type: "GET", url: this.href+"?rnd="+ Math.random(), success: function(data){
			rtr=Math.round(data);
			$("#rated").html(data.replace("\.",","));
			$("#rating").children("a").each(function (i) {
				if(i+1<=rtr)
					$(this).attr("class","star");
				else
					$(this).attr("class","star zero");
			});
		} });
		this.blur();
		return false;
	});

});